package com.bawei.mall.user.controller;

import com.bawei.common.core.domain.R;
import com.bawei.mall.user.domain.MallCusShop;
import com.bawei.mall.user.domain.MallProductCar;
import com.bawei.mall.user.service.ICusShopService;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.xml.transform.Result;
import java.util.List;

@RestController
@RequestMapping("/cart")
public class CusShopController  {
    @Autowired
    private ICusShopService cusShopService;

    @GetMapping("/list")
    public R<List<MallProductCar>> list(){
        List<MallProductCar> list= cusShopService.findList();
        return R.ok(list);
    }

    @PostMapping("/add")
    public R<MallCusShop> add(@RequestBody MallCusShop mallCusShop){
        cusShopService.add(mallCusShop);
        return R.ok();
    }

    @PostMapping("/clear")
    public R<MallCusShop> clear(){
        cusShopService.delectClear();
        return R.ok();
    }

    @PostMapping("/delete")
    public R<MallCusShop> deleteIds(@RequestParam Integer ids){
        cusShopService.deleteIds(ids);
        return R.ok();
    }

    @GetMapping("/update/quantity")
    public R<MallCusShop> quantity(@RequestParam Integer id,@RequestParam Integer quantity){
         cusShopService.quantity(id,quantity);
        return R.ok();
    }




}
